package jvm.gc;

/**
 * User: ZhangJuntao
 * Date: 13-9-7
 * Time: 下午10:59
 */
class _1MB_Data {
  public Object instance = null;
  private byte[] data = new byte[1024 * 1024 * 1];
}

class _2MB_Data {
  public Object instance = null;
  private byte[] data = new byte[1024 * 1024 * 2];
}

public class CycledReferenceProblem {
  public static void main(String[] args) {

    _1MB_Data d1 = new _1MB_Data();
    _1MB_Data d2 = new _1MB_Data();
    d1.instance = d2;
    d2.instance = d1;

    d1 = null;
    d2 = null;

    System.gc();
  }
}
